package tankgame.tankgame1;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Panel;

import javax.swing.JFrame;

public class MyTankGame1 extends JFrame {
	MyPanel mp;

	public static void main(String[] args) {
		MyTankGame1 myTankGame1 = new MyTankGame1();

	}

	public MyTankGame1() {
		mp = new MyPanel();
		this.add(mp);
		this.setSize(400, 300);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	}
}

class MyPanel extends Panel {
	Hero hero;

	public MyPanel() {
		hero = new Hero(10, 10);
	}

	@Override
	public void paint(Graphics g) {
		super.paint(g);
		g.fillRect(0, 0, 400, 300);
		drawTank(hero.getX(), hero.getY(), g, 0, 1);
	}

	public void drawTank(int x, int y, Graphics g, int direct, int type) {
		switch (type) {
		case 0:
			g.setColor(Color.YELLOW);
			break;

		case 1:
			g.setColor(Color.BLUE);
			break;
		}
		switch (direct) {
		case 0:// 向上
			break;
		case 1:// 向下
			break;
		}

		g.fillRect(x, y, 5, 30);
		g.fillRect(x + 15, y, 5, 30);
		g.fill3DRect(x + 5, y + 5, 10, 20, false);
		g.fillOval(x + 5, y + 10, 10, 10);
		g.drawLine(x + 10, y + 15, x + 10, y);
	}
}

class Tank {
	int x = 0;// 横坐标
	int y = 0;// 纵坐标

	public Tank(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}
}

class Hero extends Tank {

	public Hero(int x, int y) {
		super(x, y);
	}

}